#include "plugin.h"

Plugin::Plugin(QObject *parent) : QObject(parent),mWidget(nullptr)
{

}

Plugin::~Plugin()
{
    //closeWindow();
}

void Plugin::setConfig(QString conf)
{
    mConfigPath = conf;
}

QString Plugin::getName()
{
    return "插件测试";
}

QIcon Plugin::getIcon()
{
    return QIcon(":/new/prefix1/defaultIcon.png");
}

QWidget* Plugin::creactUi(QWidget *parent)
{
    if(isOpenUi())
        return nullptr;
    mWidget = new QWidget(parent);
    mWidget->setWindowFlags(Qt::Dialog);
    mWidget->setGeometry(100,100,300,200);
    return mWidget;
}

bool Plugin::deleteUi()
{
    if(!isOpenUi())
        return 0;
    delete mWidget;
    return 1;
}

bool Plugin::isOpenUi()
{
    if(!mWidget)
        return 0;
    return !mWidget->isHidden();
}
